/*
 * HashTable.h
 *
 *  Created on: Oct 7, 2011
 *      Author: kimi
 */

#ifndef HASHTABLE_H_
#define HASHTABLE_H_


#include <stdio.h>
#include <string.h>
#include "../FLR/FLRFile.h"

using namespace std;

class BasicHashTable {
public:
	/**
	 * obtiene una entrada en la hashtable segun el hash
	 */
	bool getEntry(unsigned long hash, unsigned long* recordNumber, unsigned long* hashSize);

	/**
	 * crea una entrada al final de la tabla
	 */
	bool addEntry(unsigned long* hash, unsigned long recordNumber, unsigned long hashSize);

	/**
	 * edita una entrada de la table
	 */
	bool editEntry(unsigned long hash, unsigned long recordNumber, unsigned long hashSize);

	void setTableSize(unsigned long size);

	unsigned long getTableSize();

	bool reduceHashTableByFactor2();
	bool increaseHashTableByFactor2();

	void purge();

	BasicHashTable(string filePath);
	virtual ~BasicHashTable();

private:

	string 		filePath;
	FLRFile*	flrFile;

	unsigned long	tableSize;
};


#endif /* HASHTABLE_H_ */
